<template>
  <div>
    <w-alert class="mb6" info icon-outside>The missing props descriptions will be added shortly (all the props are
      already listed).</w-alert>
    <component-api class="mt0" :items="props" :descriptions="propsDescs" title="Props"></component-api>
    <component-api :items="slots" title="Slots"></component-api>
    <component-api :items="events" title="Events"></component-api>
  </div>
</template>

<script>
  import WSteps from "../../../../../src/components/steps/WSteps.vue";

  const propsDescs = {};

  const slots = {};

  const events = {};

  export default {
    data: () => ({
      propsDescs,
      slots,
    }),

    computed: {
      // Reads all the props and events directly from the component, so that as soon as a new prop or event
      // is added it will appear even if no description is yet provided.
      props() {
        return WSteps.props;
      },
      events() {
        return WSteps.emits.reduce(
          (obj, label) => (obj[label] = events[label] || {}) && obj,
          {}
        );
      },
    },
  };
</script>